home *** CD-ROM | disk | FTP | other *** search
- function ArrowClick(direction)
- {
- // this function responds to mouse click on arrows to scroll iFrame
- oCurFocus = oFrame;
- oCurFocus.focus();
- scrollIframe(direction);
- }
-
-
- var oFrame;
- function setIFrameVariable(iFrameObj)
- {
- /* This function is called when the iframe loads. It identifies the iFrame
- in a global variable to be used in scrolling and focus operations */
- oFrame = iFrameObj;
- }
-
- function scrollIframe(directionBtn)
- {
- // This function is called by either the ArrowClick function or the doOnFocus function
-
- // if focus is not on the scrolling iFrame, exit the function
- if (oCurFocus != oFrame) return
-
- // Create variable for amount that the frame should be scrolled per key press
- var scrollAmnt = 0
- // Set value based on which arrow is pressed
- switch(directionBtn)
- {
- case 38: // Up arrow selected; scroll up amount indicated by the iFrame's MCScrollAmount attribute
- scrollAmnt = -(oFrame.MCScrollAmount);
- break;
- case 40: // Down button selected; scroll down amount indicated by the iFrame's MCScrollAmount attribute
- scrollAmnt = oFrame.MCScrollAmount;
- break;
- case 33: //Page (+) up btn selected; scroll up 40px less than the height of the content
- scrollAmnt = -(oFrame.clientHeight-40);
- break;
- case 34: // Page down (minus) selected; scroll down 40px less than the height of the content
- scrollAmnt = oFrame.clientHeight-40;
- break;
- }
- // if scroll amount value is not reset by above, then exit function
- if (scrollAmnt == 0) return false;
- // Scroll by amount determined above
- document.frames(oFrame.id).scrollBy(0,scrollAmnt);
- // run function to update arrow buttons on page as needed
- checkArrows();
- return true;
- }
-
- function checkArrows()
- {
- /* This function updates arrow buttons on page by graying out (using alpha opacity filter)
- up or down arrow if you are scrolled all the way to top or bottom */
- // first, turn off filter on both
- arrowUp.style.filter = "none";
- arrowDown.style.filter = "none";
- // Set some variables
- var amountScrolled = document.frames(oFrame.id).document.body.scrollTop; // variable for amount frame has scrolled
- var totalContentHeight = document.frames(oFrame.id).document.body.scrollHeight; // variable for total height of frame content
- var scrollFrameHeight = oFrame.clientHeight; // Variable for height of frame
- var totalYouCanScroll = (totalContentHeight - scrollFrameHeight); // Variable for total amount the content can scroll before you hit the end
-
- // if amount scrolled is <= 0, you are at the top so gray out up arrow
- if (amountScrolled <= 0) arrowUp.style.filter = "alpha(opacity=30)";
- // if amount scrolled is >= totalYouCanScroll, you are at the bottom so gray out down arrow
- if (amountScrolled >= totalYouCanScroll) arrowDown.style.filter = "alpha(opacity=30)";
- }
-
- function moveFocusToIFrameContent()
- {
- /* This function moves the focus from the iFrame object to the iFrame's content page. It is called
- when focus goes to placeholder span, which is strategically placed at the right on the parent page */
-
- // For tracking purposes, set oCurFocus variable to iFrame
- oCurFocus = oFrame;
- // Call function on child page to set initial focus on that page
- document.frames(oFrame.id).setContentFocus();
- }
-
- function moveFocusBackToIFrame()
- {
- // This function moves focus from the iFrame's content page back to the iFrame itself on the parent page
- // THis function gets called from the child page
- oCurFocus = oFrame;
- oCurFocus.focus();
- }
-